<?php
/**
 * Created by PhpStorm.
 * User: yanghu
 * Date: 11/02/2018
 * Time: 12:14 AM
 */
use think\Db;
if (!function_exists('p')) {
    /**
     * Url生成
     * @param string        $url 路由地址
     * @param string|array  $vars 变量
     * @param bool|string   $suffix 生成的URL后缀
     * @param bool|string   $domain 域名
     * @return string
     */
    function p($var)
    {
        echo '<pre>';
        print_r($var);
        echo "<pre/>";
    }

    function returnMsg($status,$msg,$arr = array()){
        returnMsgNoDie($status,$msg,$arr);
        die;
    }


    function returnMsgNoDie($status, $msg, $arr = array())
    {
        $json_arr['status'] = $status;
        $json_arr['message'] = $msg;
        foreach ($arr as $key => $val) {
            $json_arr[$key] = $val;
        }
        echo json_encode($json_arr);
    }


}

